var t, e = function(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}(require("../../../utils/tools.js"));

getApp();

Page({
    data: {
        amount_index: 0,
        _index: 0,
        showSelect: !1,
        request: 1,
        showPhone: !1,
        phone: "",
        show_guide_reply: !1,
        guide_reply: 1,
        audit_model: !0
    },
    onLoad: function(e) {
        t = this;
    },
    onReady: function() {
        var n = {
            action: "exchange",
            contr: "my",
            token: wx.getStorageSync("token")
        };
        e.default.request(n, function(e) {
            t.setData(e.info), wx.setNavigationBarTitle({
                title: e.info.xcx_title
            });
        });
    },
    bindChange: function(t) {
        this.data._index = t.detail.value[0];
    },
    onBgTap: function(t) {
        this.setData({
            showSelect: !1
        });
    },
    onOK: function(t) {
        this.setData({
            showSelect: !1
        }), this.setData({
            amount_index: this.data._index
        });
    },
    onAllClick: function() {
        this.setData({
            showSelect: !0,
            _index: 0
        });
    },
    hide_luck_pwd: function() {
        this.setData({
            showPhone: !1
        });
    },
    handleBuy: function() {
        var n = {
            action: "fillInPhone",
            contr: "my",
            token: wx.getStorageSync("token"),
            phone: this.data.phone
        };
        e.default.request(n, function(e) {
            t.onReady(), t.setData({
                showPhone: !1
            });
        });
    },
    inputLuckPwd: function(t) {
        this.setData({
            phone: t.detail.value
        });
    },
    showPhonePop: function() {
        this.setData({
            showPhone: !0
        });
    },
    showGuide: function() {
        t.setData({
            show_guide_reply: !0
        });
    },
    hideGuide: function() {
        t.setData({
            show_guide_reply: !1
        });
    },
    onShow: function() {},
    exchange: function() {
        var n = {
            action: "exchange",
            contr: "my",
            token: wx.getStorageSync("token"),
            money: t.data.exchange_amount[t.data.amount_index],
            op: "ex"
        };
        1 == t.data.request && (t.data.request = 2, e.default.request(n, function(e) {
            t.data.request = 1, 1 == e.status ? (wx.showToast({
                title: "兑换成功"
            }), t.onReady()) : wx.showModal({
                title: "提示",
                mask: !0,
                content: e.info,
                showCancel: !1
            });
        }));
    },
    getPhoneNumber: function(n) {
        if (console.log(n), "getPhoneNumber:ok" == n.detail.errMsg) {
            var a = {
                action: "bindPhone",
                contr: "my",
                token: wx.getStorageSync("token"),
                encryptedData: n.detail.encryptedData,
                iv: n.detail.iv
            };
            e.default.request(a, function(e) {
                t.onReady();
            });
        }
    },
    onShareAppMessage: function() {
        return {
            title: this.data.share.text,
            imageUrl: this.data.share.images,
            path: "bh_farm/pages/index/index?parent_id=" + this.data.share.member_id
        };
    }
});